package org.ezplatform.office.meeting.notice.web.client;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.collections4.MapUtils;
import org.ezplatform.cloud.api.system.user.UserApiService;
import org.ezplatform.cloud.common.controller.BaseController;
import org.ezplatform.cloud.common.log.LogService;
import org.ezplatform.core.common.WebUser;
import org.ezplatform.core.web.util.WebUtils;
import org.ezplatform.mobile.util.common.service.CommonService;
import org.ezplatform.office.meeting.common.util.MeetingUtils;
import org.ezplatform.util.DateUtils;
import org.ezplatform.util.GlobalConstant;
import org.ezplatform.util.JsonUtils;
import org.ezplatform.util.ResponseResult;
import org.ezplatform.util.RestClient;
import org.ezplatform.util.StringUtils;
import org.ezplatform.util.UuidUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.druid.support.json.JSONUtils;

import io.swagger.annotations.ApiOperation;

/**
 * 
 *会议管理--会议通知
 *
 */
@RestController
@RequestMapping("/client/office/meeting")
public class NoticeInfoClientController extends BaseController {

    @Autowired
    private UserApiService userApiService;

    @Autowired
	private LogService logService;
    
    @Autowired
	private MeetingUtils meetingUtils;
    
    @Autowired
	private CommonService commonService;
    
    /**
     * 会议通知
     */
    @ApiOperation(value="会议通知", notes="查询我参加会议的会议通知list列表数据")
    @RequestMapping(value="/attendNoticeInfoSetList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getAttendNoticeInfoSetList(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //当前页
            String currentPage = request.getParameter("page");
            //一页显示条数
            String pageSize = request.getParameter("pageSize");
            //查询条件
            String condition = request.getParameter("condition");
            //用户ID
            String userId = user.getUserId();
            //用户单位
            String corpId = user.getCorpId();
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("userId", userId);
            paramsMap.put("page", currentPage);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("condition", condition);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/noticeInfo/attendNoticeInfoSetList", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
            
            resultMap.put("success", true);
            resultMap.put("content", map);
        }catch(Exception e){
        	e.printStackTrace();
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 会议通知
     */
    @ApiOperation(value="会议通知", notes="查询我审批会议的会议通知list列表数据")
    @RequestMapping(value="/approvalNoticeInfoSetList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getApprovalNoticeInfoSetList(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //当前页
            String currentPage = request.getParameter("page");
            //一页显示条数
            String pageSize = request.getParameter("pageSize");
            //查询条件
            String condition = request.getParameter("condition");
            //用户ID
            String userId = user.getUserId();
            //用户单位
            String corpId = user.getCorpId();
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("userId", userId);
            paramsMap.put("page", currentPage);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("condition", condition);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/noticeInfo/approvalNoticeInfoSetList", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
            resultMap.put("success", true);
            resultMap.put("content", map);
        }catch(Exception e){
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 会议通知详细页面数据
     * @param request
     * @return
     */
    @ApiOperation(value="会议通知", notes="查看会议通知详细信息")
    @RequestMapping(value="/attendNoticeInfo", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getAttendNoticeInfo(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        Map<String,Object> map = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            String corpId = user.getCorpId();
            String token = user.getJwtToken();
            String userId = user.getUserId();
            String id = request.getParameter("id");
            String type = request.getParameter("type");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("id", id);
            paramsMap.put("token", token);
            paramsMap.put("userId", userId);
            paramsMap.put("type", type);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/noticeInfo/attendNoticeInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
            resultMap.put("success", true);
            resultMap.put("content",map );
            
        }catch(Exception e){
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 转本部门
     */
    @ApiOperation(value = "转本部门", notes = "转本部门")
    @RequestMapping(value = "/saveTurnoverInfo", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> saveTurnoverInfo(HttpServletRequest request) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
        	WebUser user = WebUtils.getCurrentUser();
            String corpId = user.getCorpId();
            String token = user.getJwtToken();
            String userId = user.getUserId();
            String userName = user.getCnName();
            String id =  request.getParameter("id");
            String meetingId =  request.getParameter("meetingId");
            String jsonStrReceiveUser =  request.getParameter("jsonStrReceiveUser");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("userId", userId);
            paramsMap.put("userName", userName);
            paramsMap.put("corpId", corpId);
            paramsMap.put("token", token);
            paramsMap.put("meetingId", meetingId);
            paramsMap.put("id", id);
            paramsMap.put("jsonStrReceiveUser", jsonStrReceiveUser);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/noticeInfo/saveTurnoverInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
        	String msg = StringUtils.null2String(result.get("message"));
        	if("success".equals(type)){
        		resultMap.put("success", Boolean.valueOf(true));
        		resultMap.put("content", msg);
        	}else{
        		resultMap.put("success", Boolean.valueOf(false));
        		resultMap.put("errorMsg", msg);
        	}
        } catch (Exception e) {
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "保存失败");
            e.printStackTrace();
        }
        return resultMap;
    }
    
    /**
     * 转本部门数据提交前校验
     */
    @ApiOperation(value = "转本部门数据提交前校验", notes = "转本部门数据提交前校验")
    @RequestMapping(value = "/checkTurnoverDate", method = RequestMethod.GET)
    @ResponseBody
    public Map<String, Object> checkTurnoverDate(HttpServletRequest request) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
        	WebUser user = WebUtils.getCurrentUser();
            String corpId = user.getCorpId();
            String token = user.getJwtToken();
            String userId = user.getUserId();
            String meetingId =  request.getParameter("meetingId");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("userId", userId);
            paramsMap.put("corpId", corpId);
            paramsMap.put("meetingId", meetingId);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/noticeInfo/checkTurnoverDate", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		resultMap.put("success", Boolean.valueOf(true));
    		resultMap.put("content", result);
        } catch (Exception e) {
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "保存失败");
            e.printStackTrace();
        }
        return resultMap;
    }
    
    /**
     * 修改修改会议通知状态
     */
    @ApiOperation(value = "修改会议通知状态", notes = "确认参会、请假")
    @RequestMapping(value = "/editNoticeInfo", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> editNoticeInfo(HttpServletRequest request) {
        // String corpId = WebUtils.getCurrentUser().getCorpId();
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
        	String token = WebUtils.getCurrentUser().getJwtToken();
            String id =  request.getParameter("id");
            String status =  request.getParameter("status");
            String reason =  request.getParameter("reason");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("status", status);
            paramsMap.put("id", id);
            paramsMap.put("reason", reason);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/noticeInfo/editNoticeInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
            
            if("success".equals(type)){
            	resultMap.put("success", Boolean.valueOf(true));
                resultMap.put("content", "保存会议通知状态成功");
            }else{
            	resultMap.put("success", Boolean.valueOf(false));
                resultMap.put("errorMsg", "保存会议通知状态失败");
            }

        } catch (Exception e) {
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "保存会议通知状态失败");
            e.printStackTrace();
        }
        return resultMap;
    }
    
    /**
     * 查询我发起的会议数据
     */
    @ApiOperation(value="会议查询", notes="查询我发起的会议list列表数据信息")
    @RequestMapping(value="/createApplyRecordList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getCreateApplyRecordList(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //当前页
            String currentPage = request.getParameter("page");
            //一页显示条数
            String pageSize = request.getParameter("pageSize");
            //查询条件
            String condition = request.getParameter("condition");
            //用户ID
            String userId = user.getUserId();
            //用户单位
            String corpId = user.getCorpId();
            String token = user.getJwtToken();
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("page", currentPage);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("condition", condition);
            paramsMap.put("userId", userId);
            paramsMap.put("token", token);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/search/createApplyRecordList", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
            resultMap.put("success", true);
            resultMap.put("content", map);
        }catch(Exception e){
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 查询我参与的会议数据
     */
    @ApiOperation(value="会议查询", notes="查询我参与的会议list列表数据信息")
    @RequestMapping(value="/attendApplyRecordList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getAttendApplyRecordList(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //当前页
            String currentPage = request.getParameter("page");
            //一页显示条数
            String pageSize = request.getParameter("pageSize");
            //查询条件
            String condition = request.getParameter("condition"); 
            //用户ID
            String userId = "";
            //用户单位
            String corpId = "";
            String token = "";
            userId = user.getUserId();
            corpId = user.getCorpId();
            token  = user.getJwtToken();
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("page", currentPage);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("condition", condition);
            paramsMap.put("userId", userId);
            paramsMap.put("token", token);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/search/attendApplyRecordList", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
            
    		resultMap.put("success", true);
    		resultMap.put("content", map);
           
        }catch(Exception e){
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 查询与我有关的周期会议
     */
    @ApiOperation(value="周期会议查询", notes="查询与我有关的周期会议列表数据信息")
    @RequestMapping(value="/getCycleMeetingList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getCycleMeetingList(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //当前页
            String currentPage = request.getParameter("page");
            //一页显示条数
            String pageSize = request.getParameter("pageSize");
            //查询条件
            String condition = request.getParameter("condition"); 
            //用户ID
            String userId = "";
            //用户单位
            String corpId = "";
            String token = "";
            userId = user.getUserId();
            corpId = user.getCorpId();
            token  = user.getJwtToken();
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("page", currentPage);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("condition", condition);
            paramsMap.put("userId", userId);
            paramsMap.put("token", token);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/search/getCycleMeetingList", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
            
    		resultMap.put("success", true);
    		resultMap.put("content", map);
           
        }catch(Exception e){
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 根据周期会议id查询周期会议
     */
    @ApiOperation(value="周期会议查询", notes="根据周期会议id查询周期会议")
    @RequestMapping(value="/getCycleMeetingByCycleId", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getCycleMeetingByCycleId(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //当前页
            String currentPage = request.getParameter("page");
            //一页显示条数
            String pageSize = request.getParameter("pageSize");
            //查询条件
            String condition = request.getParameter("condition"); 
            String cycleId = request.getParameter("id"); 
            //用户ID
            String userId = "";
            //用户单位
            String corpId = "";
            String token = "";
            userId = user.getUserId();
            corpId = user.getCorpId();
            token  = user.getJwtToken();
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("page", currentPage);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("condition", condition);
            paramsMap.put("cycleId", cycleId);
            paramsMap.put("userId", userId);
            paramsMap.put("token", token);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/search/getCycleMeetingByCycleId", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
            
    		resultMap.put("success", true);
    		resultMap.put("content", map);
           
        }catch(Exception e){
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    @ApiOperation(value = "实体类是否存在", notes = "")
	@RequestMapping(value="/entityIsExist", method=RequestMethod.POST, produces={"application/json; charset=UTF-8"})
    @ResponseBody
	public Map<String, Object> entityIsExist(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String id = request.getParameter("id");
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/entityIsExist", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);

            resultMap.put("success", true);
            resultMap.put("content", result.get("message"));

		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
    }
    
    @ApiOperation(value = "实体类是否存在", notes = "")
	@RequestMapping(value="/cycleEntityIsExist", method=RequestMethod.POST, produces={"application/json; charset=UTF-8"})
    @ResponseBody
	public Map<String, Object> cycleEntityIsExist(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String id = request.getParameter("id");
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            paramsMap.put("corpId", user.getCorpId());
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/cycleEntityIsExist", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);

            resultMap.put("success", true);
            resultMap.put("content", result.get("message"));

		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
    }
    
    @ApiOperation(value = "实体类是否存在", notes = "")
	@RequestMapping(value="/taskIsExist", method=RequestMethod.POST, produces={"application/json; charset=UTF-8"})
    @ResponseBody
	public Map<String, Object> taskIsExist(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String id = request.getParameter("id");
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/taskInfo/entityIsExist", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);

            resultMap.put("success", true);
            resultMap.put("content", result.get("message"));

		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
    }
    
    @ApiOperation(value = "实体类是否存在", notes = "")
	@RequestMapping(value="/memoIsExist", method=RequestMethod.POST, produces={"application/json; charset=UTF-8"})
    @ResponseBody
	public Map<String, Object> memoIsExist(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String id = request.getParameter("id");
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/memoInfo/entityIsExist", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);

            resultMap.put("success", true);
            resultMap.put("content", result.get("message"));

		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
    }
    
    /**
	 * 会议申请详细页面数据
	 * 
	 * @param request
	 * @return
	 */
	@ApiOperation(value = "会议申请", notes = "新建、编辑查看会议申请详细信息")
	@RequestMapping(value="/applyRecordInfo", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
	public Map<String, Object> getApplyRecordInfo(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		Map<String, Object> map = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String token = "";
			String corpId = "";
			String userId = "";
			if(user  == null){
				token = TOKEN;
				corpId = "0";
				userId = "402887025da0b65d015da0bdb9530003";
			}else{
				corpId = user.getCorpId();
				userId = user.getUserId();
				token = user.getJwtToken();
			}
			String id = request.getParameter("id");
			String boardroomId = request.getParameter("boardroomId");
			String type = request.getParameter("type");
			
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("id", id);
            paramsMap.put("userId", userId);
            paramsMap.put("token", token);
            paramsMap.put("boardroomId", boardroomId);
            paramsMap.put("type", type);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/applyRecordInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");

            resultMap.put("success", true);
            resultMap.put("content", map);

		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
	}
	
	@ApiOperation(value = "保存会议申请信息", notes = "保存会议申请信息")
	@RequestMapping(value = "/saveInfo", method = RequestMethod.POST)
	public Map<String, Object> saveInfo(@RequestParam("message") String message) {
        WebUser user = WebUtils.getCurrentUser();
		String token = "";
		String corpId = "";
		String userId = "";
		if(user  == null){
			token = TOKEN;
			corpId = "0";
			userId = "402887025da0b65d015da0bdb9530003";
		}else{
			corpId = user.getCorpId();
			userId = user.getUserId();
			token = user.getJwtToken();
		}
		Map<String, Object> resultMap = new HashMap<String, Object>();
		
		Map<String,String> paramsMap = new HashMap<String,String>();
        paramsMap.put("corpId", corpId);
        paramsMap.put("userId", userId);
        paramsMap.put("token", token);
        paramsMap.put("userName", user.getCnName());
        
        RestClient restClient = new RestClient();
		String configJson = restClient.post("/meeting/saveInfo", token, paramsMap, message);
		Map<String, Object> result = JsonUtils.readValue(configJson);
		String type = StringUtils.null2String(result.get("type"));
		String msg = StringUtils.null2String(result.get("message"));
		if("success".equals(type)){
			resultMap.put("success", Boolean.valueOf(true));
			resultMap.put("content", msg);
        }else{
        	resultMap.put("success", Boolean.valueOf(false));
			resultMap.put("errorMsg", msg);
        }
		return resultMap;
	}

	@ApiOperation(value = "流程提交后处理各个数据", notes = "保存会议状态和会议选人数据")
	@RequestMapping(value = "/saveInfoAfterBpm", method = RequestMethod.POST)
	public Map<String, Object> saveInfoAfterBpm(HttpServletRequest request) {
        WebUser user = WebUtils.getCurrentUser();
		String token = user.getJwtToken();
		String corpId = user.getCorpId();
		String userId = user.getUserId();
		Map<String, Object> resultMap = new HashMap<String, Object>();

		Map<String,String> paramsMap = new HashMap<String,String>();
        String id =  StringUtils.null2String(request.getParameter("id"));
        String jsonStrEmceeUser =  StringUtils.null2String(request.getParameter("jsonStrEmceeUser"));
        String jsonStrMemoUser =  StringUtils.null2String(request.getParameter("jsonStrMemoUser"));
        String jsonStrAttendUser =  StringUtils.null2String(request.getParameter("jsonStrAttendUser"));
        String nStatus =  StringUtils.null2String(request.getParameter("status"));
        paramsMap.put("id", id);
        paramsMap.put("status", nStatus);
        Map<String, String> jsonMap = new HashMap<>();
        jsonMap.put("jsonStrEmceeUser", jsonStrEmceeUser);
        jsonMap.put("jsonStrMemoUser", jsonStrMemoUser);
        jsonMap.put("jsonStrAttendUser", jsonStrAttendUser);
        String jsonStr = JSONUtils.toJSONString(jsonMap);
        paramsMap.put("userId", userId);
        paramsMap.put("userName", user.getUserName());
        paramsMap.put("corpId", corpId);
        paramsMap.put("token", token);

        RestClient restClient = new RestClient();
        String configJson = restClient.post("/meeting/saveInfoAfterBpm", token, paramsMap, jsonStr);
		Map<String, Object> result = JsonUtils.readValue(configJson);
		String type = StringUtils.null2String(result.get("type"));
		String msg = StringUtils.null2String(result.get("message"));
		if("success".equals(type)){
			resultMap.put("success", Boolean.valueOf(true));
			resultMap.put("content", msg);
        }else{
        	resultMap.put("success", Boolean.valueOf(false));
			resultMap.put("errorMsg", msg);
        }
		return resultMap;
	}

	/**
	 * 会议参会详细
	 */
	@ApiOperation(value = "会议参会详细", notes = "查询会议用户参会详细信息列表数据")
	@RequestMapping(value="/approvalNoticeInfoSetDetailsList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
	public Map<String, Object> getApprovalNoticeInfoSetDetailsList(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			String token = WebUtils.getCurrentUser().getJwtToken();
			// 当前页
			String currentPage = request.getParameter("page");
			// 一页显示条数
			String pageSize = request.getParameter("pageSize");
			Map<String, Object> map = new HashMap<String, Object>();
			String id = request.getParameter("id");
			String type = request.getParameter("type");
			
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("page", currentPage);
            paramsMap.put("id", id);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("type", type);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/approvalNoticeInfoSetList", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
    		resultMap.put("success", true);
    		resultMap.put("content", map);
		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
	}
	
	/**
	 * 会议参会详细
	 */
	@ApiOperation(value = "会议参会详细", notes = "查询会议用户参会详细信息列表数据")
	@RequestMapping(value="/getAllApprovalUserIds", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
	@ResponseBody
	public Map<String, Object> getAllApprovalUserIds(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String token = user.getJwtToken();
			Map<String, Object> map = new HashMap<String, Object>();
			String id = request.getParameter("id");
			String type = request.getParameter("type");
			
			Map<String,String> paramsMap = new HashMap<String,String>();
			paramsMap.put("corpId", user.getCorpId());
			paramsMap.put("id", id);
			paramsMap.put("token", token);
			paramsMap.put("type", type);
			
			RestClient restClient = new RestClient();
			String configJson = restClient.get("/meeting/getAllApprovalUserIds", token, paramsMap);
			Map<String, Object> result = JsonUtils.readValue(configJson);
			map = (Map<String, Object>) result.get("data");
			
			resultMap.put("success", true);
			resultMap.put("content", map);
		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
	}
	
	/**
	 * 修改会议状态
	 */
	@ApiOperation(value = "修改会议状态", notes = "同意、驳回、取消会议申请")
    @RequestMapping(value = "/editApplyRecordInfo", method = RequestMethod.POST)
	@ResponseBody
    public Map<String, Object> editApplyRecordInfo(HttpServletRequest request) {
        WebUser user = WebUtils.getCurrentUser();
        String token = user.getJwtToken();
        Map<String, Object> resultMap = new HashMap<String, Object>();

        try {
            String id =  request.getParameter("id");
            String status = request.getParameter("status");
            String noticeInfoId =  request.getParameter("noticeInfoId");
            String reason =  request.getParameter("reason");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            paramsMap.put("status", status);
            paramsMap.put("noticeInfoId", noticeInfoId);
            paramsMap.put("reason", reason);
            paramsMap.put("corpId", user.getCorpId());
            paramsMap.put("token", token);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/editApplyRecordInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
    		if("success".equals(type)){
    			resultMap.put("success", Boolean.valueOf(true));
                resultMap.put("content", "保存会议状态状态成功");
            }else{
            	resultMap.put("success", Boolean.valueOf(false));
                resultMap.put("errorMsg", result.get("message"));
            }
        } catch (Exception e) {
            e.printStackTrace();
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "保存会议状态状态失败");
        }
        return resultMap;
    }
	
	/**
     * 删除会议
     */
    @ApiOperation(value = "删除会议", notes = "删除会议申请")
    @RequestMapping(value = "/deletApplyRecordInfo", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> deletApplyRecordInfo(HttpServletRequest request) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
            String id =  request.getParameter("id");
            WebUser user = WebUtils.getCurrentUser();
            String token = user.getJwtToken();
            String corpId = user.getCorpId(); 
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            paramsMap.put("token", token);
            paramsMap.put("corpId", corpId);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/deletApplyRecordInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
    		if("success".equals(type)){
    			resultMap.put("success", Boolean.valueOf(true));
                resultMap.put("content", "删除会议成功");
            }else{
            	resultMap.put("success", Boolean.valueOf(false));
                resultMap.put("errorMsg", "删除会议失败");
            }
        } catch (Exception e) {
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "删除会议失败");
            e.printStackTrace();
        }
        return resultMap;
    }
    
    /**
     * 提前结束会议
     */
    @ApiOperation(value = "提前结束会议", notes = "")
    @RequestMapping(value = "/endApplyRecord", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> endApplyRecord(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	try {
    		String id =  request.getParameter("id");
    		String token = WebUtils.getCurrentUser().getJwtToken();
    		
    		Map<String,String> paramsMap = new HashMap<String,String>();
    		paramsMap.put("id", id);
    		
    		RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/endApplyRecord", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
    		if("success".equals(type)){
    			resultMap.put("success", Boolean.valueOf(true));
    			resultMap.put("content", "操作成功");
    		}else{
    			resultMap.put("success", Boolean.valueOf(false));
    			resultMap.put("errorMsg", "操作失败");
    		}
    	} catch (Exception e) {
    		resultMap.put("success", Boolean.valueOf(false));
    		resultMap.put("errorMsg", "操作失败");
    		e.printStackTrace();
    	}
    	return resultMap;
    }
    
    /**
	 * 修改会议签到状态
	 */
	@ApiOperation(value = "修改会议签到状态", notes = "会议签到")
    @RequestMapping(value = "/editSignedInfo", method = RequestMethod.POST)
    public Map<String, Object> editSignedInfo(HttpServletRequest request) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
        	String token = WebUtils.getCurrentUser().getJwtToken();
            String id = request.getParameter("id");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/editSignedInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
    		if("success".equals(type)){
    			resultMap.put("success",true);
                resultMap.put("content", "保存会议签到状态成功");
            }else{
            	resultMap.put("success", false);
                resultMap.put("errorMsg", "保存会议签到状态失败");
            }
        } catch (Exception e) {
            resultMap.put("success", false);
            resultMap.put("errorMsg", "保存会议签到状态失败");
            e.printStackTrace();
        }
        return resultMap;
    }
	
	/**
     * 会议纪要
     */
    @ApiOperation(value="会议纪要", notes="查询会议纪要list列表数据")
    @RequestMapping(value="/memoInfoList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getMemoInfoList(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //当前页
            String currentPage = request.getParameter("page");
            //一页显示条数
            String pageSize = request.getParameter("pageSize");
            //查询条件
            String condition = request.getParameter("condition");
            //0未读、1已读
            String type = request.getParameter("type");
            String userId = user.getUserId();
            String corpId = user.getCorpId();
            String token = user.getJwtToken();
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("page", currentPage);
            paramsMap.put("condition", condition);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("userId", userId);
            paramsMap.put("corpId", corpId);
            paramsMap.put("type", type);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/memoInfo/memoInfoList", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
            
            resultMap.put("success", true);
            resultMap.put("content", map);
        }catch(Exception e){
            e.printStackTrace();
            resultMap.put("success", false);
            resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 新建、编辑会议纪要
     * @param request
     * @return
     */
    @ApiOperation(value="会议纪要", notes="新建、编辑会议纪要")
    @RequestMapping(value="/editMemoInfo", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> editMemoInfo(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        Map<String,Object> map = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            String corpId = user.getCorpId();
            String userId = user.getUserId();
            String token = user.getJwtToken();
            String id = request.getParameter("id");
            String applyRecordId = request.getParameter("applyRecordId");
            String isViewType = request.getParameter("isViewType");
            String cnName = user.getCnName();
            String userName = user.getUserName();
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            paramsMap.put("applyRecordId", applyRecordId);
            paramsMap.put("isViewType", isViewType);
            paramsMap.put("userId", userId);
            paramsMap.put("corpId", corpId);
            paramsMap.put("token", token);
            paramsMap.put("cnName", cnName);
            paramsMap.put("userName", userName);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/memoInfo/editMemoInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		String type = StringUtils.null2String(result.get("type"));
    		if("success".equals(type)){
    			resultMap.put("success", true);
            }else{
            	resultMap.put("success", false);
            }
    		resultMap.put("content",map );
        }catch(Exception e){
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    @ApiOperation(value = "保存会议纪要", notes = "保存会议纪要")
    @RequestMapping(value = "/saveMemoInfo", method = RequestMethod.POST)
    public Map<String, Object> saveMemoInfo(HttpServletRequest request) {
        WebUser user = WebUtils.getCurrentUser();
        String token = user.getJwtToken();
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
        	String message = request.getParameter("message");
        	Map<String,String> paramsMap = new HashMap<String,String>();
//            paramsMap.put("message", message);
            paramsMap.put("token", token);
            paramsMap.put("userId", user.getUserId());
            paramsMap.put("userName", user.getCnName());
            paramsMap.put("corpId", user.getCorpId());
            paramsMap.put("org", user.getOrgId());
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/memoInfo/saveMemoInfo", token, paramsMap,message);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
    		if("success".equals(type)){
    			resultMap.put("success", Boolean.valueOf(true));
                resultMap.put("content", "保存会议纪要成功");
            }else{
            	resultMap.put("success", Boolean.valueOf(false));
                resultMap.put("errorMsg", "保存会议纪要失败");
            }
        } catch (Exception e) {
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "保存会议纪要失败");
            e.printStackTrace();
        }
        return resultMap;
    }
	
    /**
     * 会议室
     */
    @ApiOperation(value="会议室", notes="查询会议室list列表数据")
    @RequestMapping(value = "/boardroomSetList", method = RequestMethod.GET,produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getBoardroomSetList(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //查询条件
            String condition = request.getParameter("condition");
            String corpId = "";
            if(user == null){
            	corpId = "0";
            }else{
            	corpId = user.getCorpId();
            }
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("condition", condition);
            paramsMap.put("corpId", corpId);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/boardroomSet/boardroomSetList", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
            resultMap.put("content", map);
            resultMap.put("success", true);
        }catch(Exception e){
        	e.printStackTrace();
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 会议室
     */
    @ApiOperation(value="会议室", notes="查询会议室详情")
    @RequestMapping(value = "/boardRoomInfo", method = RequestMethod.GET,produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> boardRoomInfo(HttpServletRequest request) {
        Map<String,Object> resultMap = new HashMap<String,Object>();
        try{
            WebUser user = WebUtils.getCurrentUser();
            Map<String,Object> map = new HashMap<String,Object>();
            //查询条件
            String id = request.getParameter("id");
            String date = request.getParameter("date");
            String corpId = "";
            if(user == null){
            	corpId = "0";
            }else{
            	corpId = user.getCorpId();
            }
            String token = user.getJwtToken();
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", id);
            paramsMap.put("corpId", corpId);
            paramsMap.put("token", token);
            paramsMap.put("date", date);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/boardroomSet/boardRoomInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
            resultMap.put("content", map);
            resultMap.put("success", true);
        }catch(Exception e){
        	e.printStackTrace();
        	resultMap.put("success", false);
        	resultMap.put("content", "");
        }
        return resultMap;
    }
    
    /**
     * 扫码或定位签到
     */
    @ApiOperation(value="扫码或定位签到", notes="签到")
    @RequestMapping(value = "/userSigned", method = RequestMethod.GET,produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> userSigned(HttpServletRequest request) {
    	Map<String,Object> resultMap = new HashMap<String,Object>();
    	try{
    		WebUser user = WebUtils.getCurrentUser();
    		Map<String,Object> map = new HashMap<String,Object>();
    		//查询条件
    		String id = request.getParameter("id");
    		String signType = request.getParameter("signType");
    		String signedAddress = request.getParameter("signedAddress");
    		String token = user.getJwtToken();
    		Map<String,String> paramsMap = new HashMap<String,String>();
    		paramsMap.put("id", id);
    		paramsMap.put("signType", signType);
    		paramsMap.put("signedAddress", signedAddress);
    		paramsMap.put("userId", user.getUserId());
    		
    		RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/userSigned", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		resultMap.put("content", map);
    		resultMap.put("success", true);
    	}catch(Exception e){
    		e.printStackTrace();
    		resultMap.put("success", false);
    		resultMap.put("content", "");
    	}
    	return resultMap;
    }
    
    /**
     * 会议室
     */
    @ApiOperation(value="会议室", notes="查询会议室管理员")
    @RequestMapping(value = "/getBoardroomAdmin", method = RequestMethod.GET,produces={"application/json; charset=UTF-8"})
    @ResponseBody
    public Map<String,Object> getBoardroomAdmin(HttpServletRequest request) {
    	Map<String,Object> resultMap = new HashMap<String,Object>();
    	try{
    		WebUser user = WebUtils.getCurrentUser();
    		Map<String,Object> map = new HashMap<String,Object>();
    		//查询条件
    		String id = request.getParameter("id");
    		String corpId = "";
    		if(user == null){
    			corpId = "0";
    		}else{
    			corpId = user.getCorpId();
    		}
    		String token = user.getJwtToken();
    		
    		Map<String,String> paramsMap = new HashMap<String,String>();
    		paramsMap.put("id", id);
    		paramsMap.put("corpId", corpId);
    		paramsMap.put("token", token);
    		
    		RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/boardroomSet/getBoardroomAdmin", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
    		resultMap.put("content", map);
    		resultMap.put("success", true);
    	}catch(Exception e){
    		e.printStackTrace();
    		resultMap.put("success", false);
    		resultMap.put("content", "");
    	}
    	return resultMap;
    }
    
    /**
     * 查询会议室的服务树数据
     * 
     * @return
     */
    @RequestMapping(value = "/getBoardRoomServeTreeData", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> getBoardRoomServeTreeData(HttpServletRequest request) {
        WebUser user = WebUtils.getCurrentUser();
        Map<String,Object> resultMap = new HashMap<String,Object>();
        String corpId = "";
        if(user == null){
        	corpId = "0";
        }else{
        	corpId = user.getCorpId();
        }
        String boardroomId = request.getParameter("boardroomId");
        
        Map<String,String> paramsMap = new HashMap<String,String>();
        paramsMap.put("boardroomId", boardroomId);
        paramsMap.put("corpId", corpId);
        
        RestClient restClient = new RestClient();
		String configJson = restClient.get("/meeting/serveSet/getBoardRoomServeTreeData", user.getJwtToken(), paramsMap);
		Map<String, Object> result = JsonUtils.readValue(configJson);
		Map<String, Object> map = (Map<String, Object>) result.get("data");
		
        resultMap.put("success", true);
        resultMap.put("content", map);
        return resultMap;
    }
    
    /**
     * 获取二维码
     * 
     * @return
     */
    @RequestMapping(value = "/getQrcodeAttachment", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> getQrcodeAttachment(HttpServletRequest request) {
    	Map<String,Object> resultMap = new HashMap<String,Object>();
    	String id = StringUtils.null2String(request.getParameter("id"));
    	String corpId = StringUtils.null2String(request.getParameter("corpId"));
    	String token = StringUtils.null2String(request.getParameter("token"));
    	Map<String,String> paramsMap = new HashMap<String,String>();
    	paramsMap.put("id", id);
    	paramsMap.put("corpId", corpId);
    	paramsMap.put("token", token);
    	String url = GlobalConstant.getFlexOfficeQrcodeUrl(request);
    	paramsMap.put("url", url);
    	RestClient restClient = new RestClient();
    	String configJson = restClient.get("/meeting/getQrcodeAttachment", token, paramsMap);
    	Map<String, Object> result = JsonUtils.readValue(configJson);
    	resultMap.put("content", result.get("data"));
    	resultMap.put("success", true);
    	return resultMap;
    }
    
    /**
	 * 会议任务
	 */
	@ApiOperation(value = "会议任务", notes = "查询会议任务列表数据")
	@RequestMapping(value="/findTaskList", method=RequestMethod.GET, produces={"application/json; charset=UTF-8"})
    @ResponseBody
	public Map<String, Object> findTaskList(HttpServletRequest request) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String token = user.getJwtToken();
			String corpId = user.getCorpId();
			String userId = user.getUserId();
			// 当前页
			String currentPage = request.getParameter("page");
			// 一页显示条数
			String pageSize = request.getParameter("pageSize");
			String status = request.getParameter("status");
			String applyrecordId = request.getParameter("applyRecordId");
			String title = request.getParameter("title");
			Map<String, Object> map = new HashMap<String, Object>();
			
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("page", currentPage);
            paramsMap.put("status", status);
            paramsMap.put("pageSize", pageSize);
            paramsMap.put("applyrecordId", applyrecordId);
            paramsMap.put("title", title);
            paramsMap.put("corpId", corpId);
            paramsMap.put("userId", userId);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/taskInfo/findTaskList", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
    		resultMap.put("success", true);
    		resultMap.put("content", map);
		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
		return resultMap;
	}
	
	/**
     * 获取已超期和进行中任务数量
     * 
     * @return
     */
    @RequestMapping(value = "/taskInfosCount", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> taskInfosCount(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String token = user.getJwtToken();
			String corpId = user.getCorpId();
			String userId = user.getUserId();
			String applyrecordId = request.getParameter("applyrecordId");
			String title = request.getParameter("title");
			Map<String, Object> map = new HashMap<String, Object>();
			
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("applyrecordId", applyrecordId);
            paramsMap.put("title", title);
            paramsMap.put("corpId", corpId);
            paramsMap.put("userId", userId);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/taskInfo/taskInfosCount", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		map.put("userName", user.getCnName());
    		
    		resultMap.put("success", true);
    		resultMap.put("content", map);
		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
    	return resultMap;
    }
    
    /**
     * 获取已超期和进行中任务数量
     * 
     * @return
     */
    /*@RequestMapping(value = "/taskEICount", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> taskEICount(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	try {
    		WebUser user = WebUtils.getCurrentUser();
    		String token = user.getJwtToken();
    		String corpId = user.getCorpId();
    		String userId = user.getUserId();
    		Map<String, Object> map = new HashMap<String, Object>();
    		
    		Map<String,String> paramsMap = new HashMap<String,String>();
    		paramsMap.put("corpId", corpId);
    		paramsMap.put("userId", userId);
    		
    		RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/taskInfo/taskEICount", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		map.put("userName", user.getCnName());
    		
    		resultMap.put("success", true);
    		resultMap.put("content", map);
    	} catch (Exception e) {
    		resultMap.put("success", false);
    		resultMap.put("content", "");
    	}
    	return resultMap;
    }*/
    
    /**
     * 获取任务详情
     * 
     * @return
     */
    @RequestMapping(value = "/getTaskInfo", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> getTaskInfo(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			WebUser user = WebUtils.getCurrentUser();
			String token = user.getJwtToken();
			String corpId = user.getCorpId();
			String userId = user.getUserId();
			String taskInfoId = request.getParameter("taskInfoId");
			String recordId = request.getParameter("recordId");
			String editType = request.getParameter("editType");
			Map<String, Object> map = new HashMap<String, Object>();
			
			Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("taskInfoId", taskInfoId);
            paramsMap.put("corpId", corpId);
            paramsMap.put("userId", userId);
            paramsMap.put("recordId", recordId);
            paramsMap.put("editType", editType);
            paramsMap.put("token", token);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/taskInfo/getTaskInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
    		resultMap.put("success", true);
    		resultMap.put("content", map);
		} catch (Exception e) {
			resultMap.put("success", false);
			resultMap.put("content", "");
		}
    	return resultMap;
    }
    
    /**
     * 获取签到详细信息
     * 
     * @return
     */
    @RequestMapping(value = "/getSignedInfo", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> getSignedInfo(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	try {
    		WebUser user = WebUtils.getCurrentUser();
    		String token = user.getJwtToken();
    		String userId = user.getUserId();
    		String applyRecordId = request.getParameter("applyRecordId");
    		Map<String, Object> map = new HashMap<String, Object>();
    		
    		Map<String,String> paramsMap = new HashMap<String,String>();
    		paramsMap.put("userId", userId);
    		paramsMap.put("applyRecordId", applyRecordId);
    		
    		RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/getSignedInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");
    		
    		resultMap.put("success", true);
    		resultMap.put("content", map);
    	} catch (Exception e) {
    		resultMap.put("success", false);
    		resultMap.put("content", "");
    	}
    	return resultMap;
    }

    /**
     * 检验会议室是否已预约
     *
     * @return
     */
    @RequestMapping(value = "/validateMeetingTime", method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> validateMeetingTime(HttpServletRequest request) {
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	try {
    		WebUser user = WebUtils.getCurrentUser();
    		String corpId = user.getCorpId();
            String id = StringUtils.null2String(request.getParameter("id"));
            String startTime = request.getParameter("startTime");
            String endTime = request.getParameter("endTime");
            String boardroomId = request.getParameter("boardroomId");
            String isCycle = request.getParameter("isCycle");
            String cycleType = request.getParameter("cycleType");
            String cycleValue = request.getParameter("cycleValue");
            String cycleEndTime = request.getParameter("cycleEndTime");
    		Map<String, Object> map = new HashMap<String, Object>();

    		Map<String,String> paramsMap = new HashMap<String,String>();
    		paramsMap.put("corpId", corpId);
    		paramsMap.put("id", id);
    		paramsMap.put("startTime", startTime);
    		paramsMap.put("endTime", endTime);
    		paramsMap.put("boardroomId", boardroomId);
    		paramsMap.put("isCycle", isCycle);
    		paramsMap.put("cycleType", cycleType);
    		paramsMap.put("cycleValue", cycleValue);
    		paramsMap.put("cycleEndTime", cycleEndTime);

    		RestClient restClient = new RestClient();
    		String configJson = restClient.get("/meeting/validateMeetingTime", user.getJwtToken(), paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		map = (Map<String, Object>) result.get("data");

    		resultMap.put("success", true);
    		resultMap.put("content", map);
    	} catch (Exception e) {
    		resultMap.put("success", false);
    		resultMap.put("content", "");
    	}
    	return resultMap;
    }

    @ApiOperation(value = "保存会议申请信息", notes = "保存会议申请信息")
	@RequestMapping(value = "/saveTaskInfo", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> saveTaskInfo(HttpServletRequest request) {
        WebUser user = WebUtils.getCurrentUser();
		String token = user.getJwtToken();
		String corpId = user.getCorpId();
		String userId = user.getUserId();
		Map<String, Object> resultMap = new HashMap<String, Object>();
		
		Map<String,String> paramsMap = new HashMap<String,String>();
		String message =  request.getParameter("message");
        paramsMap.put("corpId", corpId);
        paramsMap.put("message", message);
        paramsMap.put("userId", userId);
        paramsMap.put("token", token);
        
        RestClient restClient = new RestClient();
		String configJson = restClient.post("/meeting/taskInfo/saveTaskInfo", token, paramsMap);
		Map<String, Object> result = JsonUtils.readValue(configJson);
		String type = StringUtils.null2String(result.get("type"));
		String msg = StringUtils.null2String(result.get("message"));
		if("success".equals(type)){
			resultMap.put("success", Boolean.valueOf(true));
			resultMap.put("content", msg);
        }else{
        	resultMap.put("success", Boolean.valueOf(false));
			resultMap.put("errorMsg", msg);
        }
		return resultMap;
	}
    
    @ApiOperation(value = "修改任务进度", notes = "根据任务id修改任务进度")
    @RequestMapping(value = "/changeProgress", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> changeProgress(HttpServletRequest request) {
    	WebUser user = WebUtils.getCurrentUser();
    	String token = user.getJwtToken();
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	
    	Map<String,String> paramsMap = new HashMap<String,String>();
    	String progress = request.getParameter("progress");
    	String comDetails = request.getParameter("comDetails");
    	String saveType = request.getParameter("type");
    	String taskInfoId = request.getParameter("taskInfoId");
    	paramsMap.put("progress", progress);
    	paramsMap.put("taskInfoId", taskInfoId);
    	paramsMap.put("comDetails", comDetails);
    	paramsMap.put("type", saveType);
    	
    	RestClient restClient = new RestClient();
    	String configJson = restClient.post("/meeting/taskInfo/changeProgress", token, paramsMap);
    	Map<String, Object> result = JsonUtils.readValue(configJson);
    	String type = StringUtils.null2String(result.get("type"));
    	String msg = StringUtils.null2String(result.get("message"));
    	if("success".equals(type)){
    		resultMap.put("success", Boolean.valueOf(true));
    		resultMap.put("content", msg);
    	}else{
    		resultMap.put("success", Boolean.valueOf(false));
    		resultMap.put("errorMsg", msg);
    	}
    	return resultMap;
    }
    
    @ApiOperation(value = "删除任务", notes = "根据任务id删除任务")
    @RequestMapping(value = "/deleteTask", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> deleteTask(HttpServletRequest request) {
    	WebUser user = WebUtils.getCurrentUser();
    	String token = user.getJwtToken();
    	String corpId = user.getCorpId();
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	
    	Map<String,String> paramsMap = new HashMap<String,String>();
    	String taskInfoId = request.getParameter("taskInfoId");
    	paramsMap.put("taskInfoId", taskInfoId);
    	paramsMap.put("corpId", corpId);
    	paramsMap.put("token", token);
    	
    	RestClient restClient = new RestClient();
    	String configJson = restClient.post("/meeting/taskInfo/delete", token, paramsMap);
    	Map<String, Object> result = JsonUtils.readValue(configJson);
    	String type = StringUtils.null2String(result.get("type"));
    	String msg = StringUtils.null2String(result.get("message"));
    	if("success".equals(type)){
    		resultMap.put("success", Boolean.valueOf(true));
    		resultMap.put("content", msg);
    	}else{
    		resultMap.put("success", Boolean.valueOf(false));
    		resultMap.put("errorMsg", msg);
    	}
    	return resultMap;
    }
    
    @ApiOperation(value = "修改签到信息", notes = "根据会议id和用户修改签到信息")
    @RequestMapping(value = "/updateSignInfo", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> updateSignInfo(HttpServletRequest request) {
    	WebUser user = WebUtils.getCurrentUser();
    	String token = user.getJwtToken();
    	Map<String, Object> resultMap = new HashMap<String, Object>();
    	
    	Map<String,String> paramsMap = new HashMap<String,String>();
    	String signedUserIds = request.getParameter("signedUserIds");
    	String applyRecordId = request.getParameter("applyRecordId");
    	paramsMap.put("signedUserIds", signedUserIds);
    	paramsMap.put("applyRecordId", applyRecordId);
    	
    	RestClient restClient = new RestClient();
    	String configJson = restClient.post("/meeting/updateSignInfo", token, paramsMap);
    	Map<String, Object> result = JsonUtils.readValue(configJson);
    	String type = StringUtils.null2String(result.get("type"));
    	String msg = StringUtils.null2String(result.get("message"));
    	if("success".equals(type)){
    		resultMap.put("success", Boolean.valueOf(true));
    		resultMap.put("content", msg);
    	}else{
    		resultMap.put("success", Boolean.valueOf(false));
    		resultMap.put("errorMsg", msg);
    	}
    	return resultMap;
    }

    /**
     * 修改会议状态
     * @param request
     */
    @ApiOperation(value = "修改会议状态", notes = "释放或是占用会议室资源")
    @RequestMapping(value = "/changeByStatusBpm", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> changeByStatusBpm(HttpServletRequest request) {
    	WebUser user = WebUtils.getCurrentUser();
    	String token = user.getJwtToken();
    	Map<String, Object> resultMap = new HashMap<String, Object>();

    	Map<String,String> paramsMap = new HashMap<String,String>();
    	String status = request.getParameter("status");
    	String applyRecordId = request.getParameter("applyRecordId");
    	paramsMap.put("status", status);
    	paramsMap.put("applyRecordId", applyRecordId);
    	paramsMap.put("type", request.getParameter("type"));
    	paramsMap.put("userId", user.getUserId());
    	paramsMap.put("userName", user.getUserName());
    	paramsMap.put("corpId", user.getCorpId());
    	paramsMap.put("token", token);

    	RestClient restClient = new RestClient();
    	String configJson = restClient.post("/meeting/changeByStatusBpm", token, paramsMap);
        Map<String, Object> result = JsonUtils.readValue(configJson);
        String type = StringUtils.null2String(result.get("type"));
        String msg = StringUtils.null2String(result.get("message"));
        if("success".equals(type)){
            resultMap.put("success", Boolean.valueOf(true));
            resultMap.put("content", msg);
        }else{
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", msg);
        }
        return resultMap;
    }

    /**
     * 是否可发起会议或取消预约
     * @param request
     */
    @ApiOperation(value = "是否可发起会议或取消预约", notes = "预约会议室流程结束后判断是否可发起会议或是否可取消预约会议室")
    @RequestMapping(value = "/canCancelMeeting", method = RequestMethod.GET)
    @ResponseBody
    public Map<String, Object> canCancelMeeting(HttpServletRequest request) {
        WebUser user = WebUtils.getCurrentUser();
        String token = user.getJwtToken();
        Map<String, Object> resultMap = new HashMap<String, Object>();

        Map<String,String> paramsMap = new HashMap<String,String>();
        String applyRecordId = request.getParameter("applyRecordId");
        paramsMap.put("corpId", user.getCorpId());
        paramsMap.put("id", applyRecordId);

        RestClient restClient = new RestClient();
        String configJson = restClient.get("/meeting/canCancelMeeting", token, paramsMap);
        Map<String, Object> result = JsonUtils.readValue(configJson);
        String type = StringUtils.null2String(result.get("type"));
        String data = StringUtils.null2String(result.get("message"));
        if("success".equals(type)){
            resultMap.put("success", Boolean.valueOf(true));
            resultMap.put("content", data);
        }else{
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("content", "");
        }
        return resultMap;
    }

    /**
     * 获得流程列表
     *
     * @param entity
     * @param model
     * @return
     * @throws ParseException
     */
    @RequestMapping(value = "/getProcessInfoList", method = RequestMethod.GET, produces = {"application/json; charset=UTF-8"})
    @ResponseBody
    public ResponseResult getProcessInfoList(String entity, HttpServletRequest request) throws ParseException {
        String type = request.getParameter("type");
        String page = request.getParameter("page");
        String pageSize = request.getParameter("pageSize");
        String search = StringUtils.null2String(request.getParameter("search"));
        RestClient restClient = new RestClient(true);
        int pageSizeInt = 10;
        int start = 0;

        if (StringUtils.isNotBlank(pageSize)) {
            pageSizeInt = Integer.parseInt(pageSize);

        }
        if (StringUtils.isNotBlank(page)) {
            start = (Integer.parseInt(page) - 1) * pageSizeInt;
        }

        WebUser user = WebUtils.getCurrentUser();

        String token = user.getJwtToken();
        String userId = user.getUserId();
        String orgId = user.getOrgId();
        String corpId = user.getCorpId();

        Map<String, String> paramMap = new HashMap<String, String>();
        Map<String, Object> searchMap = new HashMap<String, Object>();
        searchMap.put("title", search);
        searchMap.put("startUserName", "");
        paramMap.put("searchData", JsonUtils.writeValueAsString(searchMap));
        Map<String, Object> resultMap = new HashMap<String, Object>();
        Map<String, Object> dataMap = new HashMap<String, Object>();
        if (type.equals("1")) {//待办
            paramMap.put("code", "");
            paramMap.put("category", "");
            paramMap.put("userId", userId);
            paramMap.put("groupId", orgId);
            paramMap.put("corpId", corpId);
            paramMap.put("index", start + "");
            paramMap.put("limit", pageSizeInt + "");
            paramMap.put("module", "meeting");

            try {
                String scopeMap1 = restClient.get("/bpm/runtime/getUndoTaskList", token, paramMap);
                Map<String, Object> map1 = JsonUtils.readValue(scopeMap1);
                if (map1.get("type").toString().equals("success")) {
                    Map<String, Object> resultMap1 = (Map<String, Object>) map1.get("data");
                    dataMap.put("data", resultMap1.get("list"));
                    dataMap.put("count", resultMap1.get("count"));
                    dataMap.put("currentPage", Integer.parseInt(page));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (type.equals("2")) {//已办
            paramMap.put("code", "");
            paramMap.put("category", "");
            paramMap.put("userId", userId);
            paramMap.put("groupId", orgId);
            paramMap.put("corpId", corpId);
            paramMap.put("index", start + "");
            paramMap.put("limit", pageSizeInt + "");
            paramMap.put("module", "meeting");
            try {
                String scopeMap1 = restClient.get("/bpm/runtime/getDoneProcessList", token, paramMap);
                Map<String, Object> map1 = JsonUtils.readValue(scopeMap1);
                if (map1.get("type").toString().equals("success")) {
                    Map<String, Object> resultMap1 = (Map<String, Object>) map1.get("data");
                    dataMap.put("data", resultMap1.get("list"));
                    dataMap.put("count", resultMap1.get("count"));
                    dataMap.put("currentPage", Integer.parseInt(page));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (type.equals("3")) {//我的
            paramMap.put("code", "");
            paramMap.put("category", "");
            paramMap.put("userId", userId);
            paramMap.put("groupId", orgId);
            paramMap.put("corpId", corpId);
            paramMap.put("index", start + "");
            paramMap.put("limit", pageSizeInt + "");
            paramMap.put("module", "meeting");
            try {
                String scopeMap1 = restClient.get("/bpm/runtime/getMyProcessList", token, paramMap);
                Map<String, Object> map1 = JsonUtils.readValue(scopeMap1);
                if (map1.get("type").toString().equals("success")) {
                    Map<String, Object> resultMap1 = (Map<String, Object>) map1.get("data");
                    dataMap.put("data", resultMap1.get("list"));
                    dataMap.put("count", resultMap1.get("count"));
                    dataMap.put("currentPage", Integer.parseInt(page));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return ResponseResult.buildSuccessResult(dataMap);
    }

    /**
     * 获取预约会议室流程详情
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/getMeetingRoomBpmInfo", method = RequestMethod.POST, produces = {"application/json; charset=UTF-8"})
    @ResponseBody
    public ResponseResult getMeetingRoomBpmInfo(HttpServletRequest request) {
        Map<String, Object> dataMap = new HashMap<String, Object>();
        RestClient restClient = new RestClient(true);
        WebUser user = WebUtils.getCurrentUser();
        String corpId = user.getCorpId();
        String userId = user.getUserId();
        String token = user.getJwtToken();
        String title = request.getParameter("title");
        String formId = request.getParameter("formId");
        String dataId = request.getParameter("dataId");
        String taskId = request.getParameter("taskId");
        String processInstanceId = request.getParameter("processInstanceId");
        //String dealwithId = request.getParameter("dealwithId");
        String type = request.getParameter("type");
        String logCode = "";
        if (type.equals("0")) logCode = "meeting:pending:03";//待办
        else if(type.equals("1")) logCode = "meeting:unRead:03";//待阅
        else if(type.equals("2")) logCode = "meeting:done:03";//已办
        else if(type.equals("3")) logCode = "meeting:read:03";//已阅
        else if(type.equals("4")) logCode = "meeting:my:03";//我的
        else if(type.equals("5")) type = "0";
        //String startUserId = request.getParameter("startUserId");
        //String handleUserId = request.getParameter("handleUserId");
        String boardroomId = StringUtils.null2String(request.getParameter("boardroomId"));
        String startTime = StringUtils.null2String(request.getParameter("startTime"));
        String endTime = StringUtils.null2String(request.getParameter("endTime"));
        String cycleEndTime = StringUtils.null2String(request.getParameter("cycleEndTime"));
        //查找表单详情
        Map<String, String> paramMap1 = new HashMap<String, String>();
        paramMap1.put("formId", formId);
        paramMap1.put("dataId", dataId);
        paramMap1.put("formType", "4");

        String handleUserDingId = "";
        //获取当前办理用户第三方id
//		if(StringUtils.isNoneBlank(handleUserId)){
//			Map<String, Object> userMap = userApiService.getUserInfo(handleUserId, corpId, token);
//			handleUserDingId = userMap.get("thirdUId").toString();
//		}
        Map<String, Object> map2 = null;
        if(type.equals("2")) {//已办
        	Map<String, String> formkeyParam = new HashMap<String, String>();
            formkeyParam.put("corpId", corpId);
            formkeyParam.put("userId", userId);
            formkeyParam.put("taskId", taskId);
            String formkeyConfigJson = restClient.get("/bpm/runtime/getProcessInfo", token, formkeyParam);
            map2 = JsonUtils.readValue(formkeyConfigJson);
            if ("0".equals(map2.get("code"))) {
            	Map<String, Object> formkeyForm = (Map<String, Object>)map2.get("data");
            	formId = (String)formkeyForm.get("formKey");
            }
        }
        Map<String, String> textParams = new HashMap<String, String>();
        textParams.put("corpId", corpId);
        // 表单ID
        textParams.put("formId", formId);
        textParams.put("userId", userId);
        // 获取移动表单
        String configJson = restClient.get("/model/form/mobile/getMobileFormContent", user.getJwtToken(), textParams);
        // 取得返回数据
        Map<String, Object> formContent = JsonUtils.readValue(configJson);
        Map<String, Object> form = new HashMap<>();
        List<Map<String, Object>> realItem = new ArrayList<>();
        if ("0".equals(formContent.get("code"))) {
            // 获取移动表单成功
            String data = (String) formContent.get("data");
            form = JsonUtils.readValue(data);
        }else{
            return ResponseResult.buildFailureResult(formContent.get("message").toString());
        }
        List<Map<String, Object>> addressLists = new ArrayList<>();
        try {
            String scopeMap1 = restClient.get("/model/form/getEditFormData", token, paramMap1);
            Map<String, Object> map1 = JsonUtils.readValue(scopeMap1);
            if (map1.get("type").toString().equals("success")) {
                Map<String, Object> resultMap1 = (Map<String, Object>) map1.get("data");
                List list = (List) resultMap1.get("mainTblData");
                dataMap.put("formData", resultMap1);
                if(list.size()>0){
                    Map<String, Object> resultMap2 = new HashMap<String, Object>();
                    resultMap2.putAll(resultMap1);
                    List<Map<String, Object>> dataList = (List<Map<String, Object>>) resultMap2.get("mainTblData");
                    Iterator it = dataList.iterator();
                    String att_key = "";
                    String att_value = "";
                    RestClient restClient1 = new RestClient();
                    while (it.hasNext()) {
                        Map p = (Map) it.next();
                        //p.put("value",StringUtils.null2String(p.get("value")));
                        if (StringUtils.equals(StringUtils.null2String(p.get("key")), "boardroom_id")) {
                            Map<String,String> paramsMap = new HashMap<String,String>();
                            boardroomId = StringUtils.null2String(p.get("value"));
                            paramsMap.put("id", boardroomId);
                            paramsMap.put("type", "0");
                            String resultJson = restClient1.get("/meeting/boardroomSet/getBoardRoomOrServes", token, paramsMap);
                            Map<String, Object> result = JsonUtils.readValue(resultJson);
                            Map<String, String> map = (Map<String, String>) result.get("data");
                            //p.put("showValue", map.get("name"));
                        } else if (StringUtils.equals(StringUtils.null2String(p.get("key")), "meeting_serve")) {
                            Map<String,String> paramsMap = new HashMap<String,String>();
                            paramsMap.put("id", StringUtils.null2String(p.get("value")));
                            paramsMap.put("type", "1");
                            String resultJson = restClient1.get("/meeting/boardroomSet/getBoardRoomOrServes", token, paramsMap);
                            Map<String, Object> result = JsonUtils.readValue(resultJson);
                            Map<String, String> map = (Map<String, String>) result.get("data");
                            //p.put("showValue", map.get("name"));
                        } else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "start_time")){
                            startTime = StringUtils.null2String(p.get("value"));
                        }else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "end_time")){
                            endTime = StringUtils.null2String(p.get("value"));
                        }else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "end_time")){
                            endTime = StringUtils.null2String(p.get("value"));
                        }else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "emcee_user") ||
                                 StringUtils.equals(StringUtils.null2String(p.get("key")), "memo_user") ||
                                 StringUtils.equals(StringUtils.null2String(p.get("key")), "attend_user")){
                            p.put("realValue", p.get("value"));
                        }else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "cycle_end_time")) {
                        	cycleEndTime = StringUtils.null2String(p.get("value"));
                        }
                    }
                    Iterator realIit = list.iterator();
                    String cycleType = "", cycleValue = "";
                    while (realIit.hasNext()) {
                        Map p = (Map) realIit.next();
                        if (StringUtils.equals(StringUtils.null2String(p.get("key")), "cycle_type")) {
                        	cycleType = StringUtils.null2String(p.get("value"));
                        } else if (StringUtils.equals(StringUtils.null2String(p.get("key")), "cycle_value")) {
                        	cycleValue = StringUtils.null2String(p.get("value"));
                        } else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "interval_date") && "0".equals(cycleType)) {
                        	p.put("value", cycleValue);
                        } else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "repetitive_week") && "1".equals(cycleType)) {
                        	p.put("value", cycleValue);
                        } else if(StringUtils.equals(StringUtils.null2String(p.get("key")), "repetitive_month")) {
                        	if("2".equals(cycleType)) p.put("value", cycleValue);
                        	else p.put("value", "1");
                        }
                    }
                }else{
                    if(StringUtils.isNotEmpty(dataId)){
                        return ResponseResult.buildFailureResult("表单数据已删除");
                    }
                }
            }else{
                return ResponseResult.buildFailureResult(map1.get("message").toString());
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseResult.buildFailureResult("查询表单接口调用失败");
        }

        String boardroomName="", position="", longitude="", latitude="";
        List<Map> serves = new ArrayList<>();
        if(boardroomId != ""){
            RestClient restClient1 = new RestClient();
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("id", boardroomId);
            paramsMap.put("type", "3");
            paramsMap.put("corpId", corpId);
            String resultJson = restClient1.get("/meeting/boardroomSet/getBoardRoomOrServes", token, paramsMap);
            Map<String, Object> result = JsonUtils.readValue(resultJson);
            Map<String, Object> map = (Map<String, Object>) result.get("data");
            boardroomName = StringUtils.null2String(map.get("name"));
            position = StringUtils.null2String(map.get("position"));
            longitude = StringUtils.null2String(map.get("longitude"));
            latitude = StringUtils.null2String(map.get("latitude"));
            serves = (List<Map>) map.get("serves");
        }
        List<Map<String, Object>> item = (List<Map<String, Object>>)form.get("item");
        for (Map<String, Object> map: item) {
            String itemCode = StringUtils.null2String(map.get("itemCode"));
            String value = StringUtils.null2String(map.get("value"));
            if(itemCode.equals("boardroom_id")){
                List multiItems = new ArrayList();
                Map<String, String> multiItem = new HashMap<>();
                multiItem.put("name", boardroomName);
                multiItem.put("value", boardroomId);
                multiItems.add(multiItem);
                map.put("multiItems", multiItems);
                map.put("value", boardroomId);
                map.put("defaultValue", boardroomId);
                map.put("itemType", "select");
            }else if(itemCode.equals("meeting_serve")){
                map.put("multiItems", serves);
                map.put("itemType", "checkbox");
            }else if(itemCode.equals("start_time")){
                map.put("itemType", "datetimeStep");
                map.put("dateFormat", "YMDHM");
                map.put("selectValue", startTime);
                map.put("defaultValue", startTime);
                map.put("value", startTime);
            }else if(itemCode.equals("end_time")){
                map.put("selectValue", endTime);
                map.put("defaultValue", endTime);
                map.put("value", endTime);
                map.put("itemType", "datetimeStep");
                map.put("dateFormat", "YMDHM");
            }else if(itemCode.equals("is_cycle") || itemCode.equals("is_notice") || itemCode.equals("is_signed")){
            	if(itemCode.equals("is_notice")){
                	String noticeType = commonService.getSysParamValueByMark(corpId, token, "sysImType");
                	map.put("noticeType", noticeType);
                }
            	map.put("itemType", "switch");
                map.put("defaultValue", "0");
                if("".equals(value)){
                    map.put("value", "0");
                }
            }else if(itemCode.equals("cycle_type")){
                map.put("defaultValue", "0");
                if("".equals(value)){
                    map.put("value", "0");
                }
            }else if(itemCode.equals("repetitive_week")){
            	List<Map<String, Object>> weekList = new ArrayList<Map<String, Object>>();
            	Map<String, Object> weekMap = null;
            	String week = "";
            	for(int i = 1; i <= 7; i++) {
            		weekMap = new HashMap<String, Object>();
            		if(i == 1) week = "星期天";
            		else if(i == 2) week = "星期一";
            		else if(i == 3) week = "星期二";
            		else if(i == 4) week = "星期三";
            		else if(i == 5) week = "星期四";
            		else if(i == 6) week = "星期五";
            		else if(i == 7) week = "星期六";
            		weekMap.put("name", week);
            		weekMap.put("value", i);
            		weekList.add(weekMap);
            	}
            	map.put("multiItems", weekList);
                map.put("itemType", "checkbox");
            }else if(itemCode.equals("repetitive_month")){
            	List<Map<String, Object>> monthList = new ArrayList<Map<String, Object>>();
            	Map<String, Object> monthMap = null;
            	for(int i = 1; i <= 31; i++) {
            		monthMap = new HashMap<String, Object>();
            		monthMap.put("name", i + "日");
            		monthMap.put("value", i);
            		monthList.add(monthMap);
            	}
                map.put("multiItems", monthList);
                map.put("itemType", "select");
                map.put("defaultValue", "1");
                if("".equals(value)){
                    map.put("value", "1");
                }
            }else if(itemCode.equals("cycle_end_time")){
            	String time = StringUtils.isNotEmpty(cycleEndTime) ? cycleEndTime : DateUtils.formatDate(new Date(), "yyyy-MM-dd");
            	map.put("itemType", "datetimeStep");
                map.put("dateFormat", "YMD");
                map.put("selectValue", time);
                map.put("defaultValue", time);
                map.put("value", time);
            }else if(itemCode.equals("message_push")){
            	String messagePushSW = commonService.getMessagePush(corpId, token ,"meeting");
            	map.put("messagePushSW", messagePushSW);
            }else if(itemCode.equals("notice_time")){
            	String noticeType = commonService.getSysParamValueByMark(corpId, token, "sysImType");
            	map.put("noticeType", noticeType);
                map.put("defaultValue", "5");
                if("".equals(value)){
                    map.put("value", "5");
                }
            }else if(itemCode.equals("signed_type")){
                map.put("defaultValue", "0");
                if("".equals(value)){
                    map.put("value", "0");
                }
            }else if(itemCode.equals("signed_range")){
                map.put("defaultValue", "100");
                if("".equals(value)){
                    map.put("value", "100");
                }
            }else if(itemCode.equals("signed_time")){
                map.put("defaultValue", "10");
                if("".equals(value)){
                    map.put("value", "10");
                }
            }else if(itemCode.equals("oa_meeting_signed_addr")){//签到地址
                List<Map<String, Object>> children = (List<Map<String, Object>>)map.get("children");
                List<Map<String, Object>> realChildren = new ArrayList<>();
                if(children!=null && children.size()>0){
                    for (Map<String, Object> child: children) {
                        String childItemCode = StringUtils.null2String(child.get("itemCode"));
                        if(StringUtils.isEmpty(dataId)){
                            if(childItemCode.equals("signed_address")){
                                child.put("itemType", "positioning");
                                child.put("defaultValue", position);
                                child.put("value", position);
                            }else if(childItemCode.equals("longitude")){
                                child.put("defaultValue", longitude);
                                child.put("value", longitude);
                            }else if(childItemCode.equals("latitude")){
                                child.put("defaultValue", latitude);
                                child.put("value", latitude);
                            }
                        }
                        realChildren.add(child);
                    }
                }
                map.put("children", realChildren);
            }
            realItem.add(map);
        }
        form.put("item", realItem);
        dataMap.put("form", form);

        //查找流程详情
        String isCanDealwith = "0";
        Map<String, String> paramMap2 = new HashMap<String, String>();
        paramMap2.put("corpId", corpId);
        paramMap2.put("userId", userId);
        String urlName = "";
        if (type.equals("0")) {//待办
            paramMap2.put("taskId", taskId);
            paramMap2.put("lock", "1");
            urlName = "/bpm/runtime/getUndoTaskInfo";
        }else if(type.equals("1")){//待阅
        	paramMap2.put("processInstanceId", processInstanceId);
            urlName = "/bpm/runtime/getProcessInfo";
        }else if(type.equals("2")){//已办
//            paramMap2.put("taskId", taskId);
//            urlName = "/bpm/runtime/getProcessInfo";
        }else if(type.equals("3")){//已阅
        	paramMap2.put("processInstanceId", processInstanceId);
            urlName = "/bpm/runtime/getProcessInfo";
        }else{
            paramMap2.put("processInstanceId", processInstanceId);
            urlName = "/bpm/runtime/getProcessInfo";
        }
        
        //paramMap2.put("processInstanceId", processInstanceId);
        //流程列表展示
        List<Map<String, Object>> processList = new ArrayList<Map<String, Object>>();
        try {
        	String scopeMap2 = "";
        	if(!type.equals("2")) {
        		scopeMap2 = restClient.get(urlName, token, paramMap2);
                map2 = JsonUtils.readValue(scopeMap2);
        	}
            if (map2.get("type").toString().equals("success")) {
                if (type.equals("0")) {//待办
                    Map<String, Object> resultMap2 = (Map<String, Object>) map2.get("data");
                    dataMap.put("processType", resultMap2.get("processType"));
                    dataMap.put("code", resultMap2.get("code"));
                    String userIds = "";

                    dataMap.put("processIsComplete", "0");

                    //dataMap.put("doneUserList", resultMap2.get("doneUserList"));

                    Map<String,Object> fieldControll = new HashMap<String,Object>();
                    String showFields = resultMap2.get("showFields") == null ? null : resultMap2.get("showFields").toString() + ",oa_meeting_apply_record_interval_date,oa_meeting_apply_record_repetitive_week,oa_meeting_apply_record_repetitive_month";
                    fieldControll.put("showFields", showFields);
                    fieldControll.put("editFields", resultMap2.get("editFields"));
                    fieldControll.put("hiddenFields", resultMap2.get("hiddenFields"));
                    fieldControll.put("mustFields", resultMap2.get("mustFields"));
                    dataMap.put("fieldControll",fieldControll);

                    //是否有批示意见
                    if (resultMap2.get("commentField") != null && resultMap2.get("commentField") != "null") {
                        dataMap.put("hasCommentField", '1');
                    } else {
                        dataMap.put("hasCommentField", '0');
                    }

                    //批示意见列表
                    if (resultMap2.get("commentList") != null) {
                        dataMap.put("commentList",  dealwithComment((List<Map<String,Object>>) resultMap2.get("commentList"),corpId,token));
                    } else {
                        dataMap.put("commentList", new ArrayList());
                    }

                    //按钮(待办的时候)
                    if (resultMap2.get("buttons") != null) {
                        dataMap.put("buttons", resultMap2.get("buttons"));
                    } else {
                        dataMap.put("buttons", "");
                    }

                    //流程锁(待办的时候)
                    if (resultMap2.get("lock") != null) {
                        dataMap.put("lock", resultMap2.get("lock"));
                    } else {
                        dataMap.put("lock", "");
                    }

                    //节点类型(0：单人，1：会签，2：串签)
                    if (resultMap2.get("participantMode") != null) {
                        dataMap.put("participantMode", resultMap2.get("participantMode"));
                    }else {
                        dataMap.put("participantMode", "");
                    }
                    //是否紧急
                    if (resultMap2.get("urgency") != null) {
                        dataMap.put("urgency", resultMap2.get("urgency"));
                    }else {
                        dataMap.put("urgency", "0");
                    }

                    //是否是开始节点
                    if(resultMap2.get("isStart") != null){
                        dataMap.put("isStart", resultMap2.get("isStart").toString().equals("true")?true:false);
                    }else{
                        dataMap.put("isStart", false);
                    }


                    //随机流程
                    if(resultMap2.get("tasktype") != null){
                        dataMap.put("tasktype", resultMap2.get("tasktype").toString());
                        dataMap.put("level", resultMap2.get("level").toString());
                        dataMap.put("levelCount", resultMap2.get("levelCount").toString());
                    }else{
                        dataMap.put("tasktype", "");
                    }
                    isCanDealwith = "1";

                    //标题
                    if (resultMap2.get("title") != null) {
                        dataMap.put("title", resultMap2.get("title"));
                    } else {
                        dataMap.put("title", "");
                    }

//                    Map param3 = new HashMap();
//                    param3.put("userId", user.getUserId());
//                    param3.put("corpId", user.getCorpId());
//                    param3.put("taskId", taskId);
//                    String flowListJson = restClient.get("/bpm/getProcessInfo",token, param3);
//                    Map<String,Object> flowListMap = JsonUtils.readValue(flowListJson);
                } else {//已办我的
                    Map<String, Object> resultMap2 = (Map<String, Object>) map2.get("data");
                    dataMap.put("processType", resultMap2.get("processType"));
                    dataMap.put("code", resultMap2.get("code"));
                    String userIds = "";
                    if (resultMap2.get("doingUserList") != null) {
                        List<Map<String, Object>> doingUserList = (List<Map<String, Object>>) resultMap2.get("doingUserList");
                        if (doingUserList!=null && doingUserList.size() > 0) {

                            for (Map<String, Object> doingUser : doingUserList) {
                                String doingUserId = doingUser.get("userId").toString();
                                String doingTaskId = doingUser.get("taskId").toString();
                                if (type.equals("0")) {//待办
                                    if (doingTaskId.equals(taskId) && doingUserId.equals(userId)) {
                                        isCanDealwith = "1";
                                    }
                                }

                                userIds += doingUser.get("userId").toString() + ",";
                            }
                            if (StringUtils.isNoneBlank(userIds)) {
                                userIds = userIds.substring(0, userIds.length() - 1);
                            }
                            List<String> userMap = userApiService.getUserIdBySysOrThird( userIds,"1","DD",corpId, token);
                            //handleUserDingId = userMap.get("thirdUId").toString();
                            dataMap.put("handleUserDingId", userMap);
                        } else {
                            dataMap.put("handleUserDingId", new ArrayList());
                        }
                    } else {
                        dataMap.put("handleUserDingId", new ArrayList());
                    }

                    if (resultMap2.get("processEndTime") != null) {
                        dataMap.put("processIsComplete", "1");
                    } else {
                        dataMap.put("processIsComplete", "0");
                    }

                    //在办用户列表
                    if (resultMap2.get("doingUserList") != null) {
                        dataMap.put("doingUserList", resultMap2.get("doingUserList"));
                    } else {
                        dataMap.put("doingUserList", resultMap2.get("doingUserList"));
                    }

                    //已办记录
                    if (resultMap2.get("processLogList") != null) {
                        dataMap.put("processLogList", resultMap2.get("processLogList"));
                    } else {
                        dataMap.put("processLogList", resultMap2.get("processLogList"));
                    }

                    //批示意见
                    if (resultMap2.get("commentList") != null) {
                        dataMap.put("commentList", dealwithComment((List<Map<String,Object>>) resultMap2.get("commentList"),corpId,token));
                    } else {
                        dataMap.put("commentList", new ArrayList());
                    }

                    //按钮
                    if (resultMap2.get("buttons") != null) {
                        dataMap.put("buttons", resultMap2.get("buttons"));
                    } else {
                        dataMap.put("buttons", "");
                    }

                    //起始节点按钮
                    if (resultMap2.get("startButtons") != null) {
                        dataMap.put("startButtons", resultMap2.get("startButtons"));
                    } else {
                        dataMap.put("startButtons", "");
                    }

                    if(type.equals("1")) {//已办的表单详情控制隐藏
                        Map<String, String> hm = new HashMap<String, String>();
                        hm.put("userId", user.getUserId());
                        hm.put("corpId", user.getCorpId());
                        hm.put("taskId", taskId);
                        hm.put("formId", formId);
                        String json = restClient.get("/bpm/runtime/getReadTaskInfo", user.getJwtToken(), hm);
                        Map<String, Object> hm1 = JsonUtils.readValue(json);
                        Map<String,Object> readMap = (Map<String, Object>) hm1.get("data");

                        Map<String, Object> fieldControll = new HashMap<String, Object>();
                        fieldControll.put("hiddenFields", readMap.get("hiddenFields"));
                        fieldControll.put("mobileFields", readMap.get("mobileFields"));
                        dataMap.put("fieldControll", fieldControll);
                        //是否有批示意见
                        if (readMap.get("commentField") != null && readMap.get("commentField") != "null" && StringUtils.equals(readMap.get("owntype").toString(),"read")) {
                            dataMap.put("hasCommentField", '1');
                        } else {
                            dataMap.put("hasCommentField", '0');
                        }
                    }
                    Map<String, String> hmParam = new HashMap<String, String>();
                    hmParam.put("taskId", taskId);
                    RestClient restClient2 = new RestClient(false);
                    String json2 = restClient2.get("/approve/getReadTypeByTaskId", user.getJwtToken(), hmParam);
                    Map<String, Object> hm2 = JsonUtils.readValue(json2);
                    //判断是否已阅，1，未阅，2是已阅
                    dataMap.put("readtype", hm2.get("message"));
                    
                    //流程状态，0未结束，1结束，3，作废，4，取消
                    if (resultMap2.get("status") != null) {
                        dataMap.put("processStatus", resultMap2.get("status"));
                    } else {
                        dataMap.put("processStatus", "0");
                    }

                    //标题
                    if (resultMap2.get("title") != null) {
                        dataMap.put("title", resultMap2.get("title"));
                    } else {
                        dataMap.put("title", "");
                    }
                }
            } else {
                //dataMap.put("handleUserDingId", new ArrayList());
                return ResponseResult.buildFailureResult(map2.get("message").toString());
            }


            //查询创建人
//			if(StringUtils.isNotBlank(startUserId)){
//				Map<String, Object> createUserInfo = userApiService.getUserMainOrgStaData(startUserId,"",corpId,token);
//				String createUserName = createUserInfo.get("userName").toString();
//				String createOrgName = createUserInfo.get("orgName").toString();
//				dataMap.put("createUserName", createUserName);
//				dataMap.put("createOrgName", createOrgName);
//			}
            

        } catch (Exception e) {
            e.printStackTrace();
            //记录日志
            if(StringUtils.isNotEmpty(logCode) && title != null && logService.checkOptLog(corpId, logCode, user.getJwtToken())) //判断是否记录日志
            	this.logService.saveModuleLog(logCode, title, "", UuidUtils.UUID());  
            return ResponseResult.buildFailureResult("流程详情接口调用失败");
        }
        dataMap.put("isCanDealwith", isCanDealwith);
        dataMap.put("processList", processList);
        //获取系统设置参数  水印
        String sysWatermark = commonService.getSysParamValueByMark(corpId, token,"sysWatermark");
        if(StringUtils.isNoneBlank(sysWatermark) && sysWatermark.indexOf("bpm")>-1) {//标识流程表单需要显示水印
          sysWatermark = user.getCnName()+user.getUserName();
        }else {
          sysWatermark = "";
        }
        dataMap.put("sysWatermark", sysWatermark);
        //记录日志
        if(StringUtils.isNotEmpty(logCode) && title != null && logService.checkOptLog(corpId, logCode, user.getJwtToken())) //判断是否记录日志
        	this.logService.saveModuleLog(logCode, title, "");  
        return ResponseResult.buildSuccessResult(dataMap);
    }

    /**
     * 处理批示意见显示
     * @param commentList
     * @return
     */
//    public List<Map<String,Object>> dealwithComment(List<Map<String,Object>> commentList,String corpId,String token){
//    	RestClient restClient = new RestClient(true);
//    	for(int i=0; i<commentList.size(); i++){
//            Map<String,Object> comment = commentList.get(i);
//            String type = StringUtils.null2String(comment.get("type"));
//            if ("text0".equals(type)) {//姓名+日期时间
//            }else if("text1".equals(type)){//姓名+日期
//                String time = StringUtils.null2String(comment.get("time"));
//                if(StringUtils.isNotBlank(time)){
//                    time = time.substring(0,10);
//                    comment.put("time",time);
//                }
//            }else if("text2".equals(type)){//签名图片+日期时间
//                String userId = StringUtils.null2String(comment.get("userId"));
//                Map<String, Object> user = userApiService.getUser(userId,corpId,"",token);
//                String signPic = StringUtils.null2String(user.get("signPic"));
//                if(StringUtils.isNotBlank(signPic)){
//                    comment.put("signPic",signPic);
//                }else{
//                    comment.put("signPic","");
//                }
//            }else if("text3".equals(type)){//签名图片+日期
//                String time = StringUtils.null2String(comment.get("time"));
//                if(StringUtils.isNotBlank(time)){
//                    time = time.substring(0,10);
//                    comment.put("time",time);
//                }
//                String userId = StringUtils.null2String(comment.get("userId"));
//                Map<String, Object> user = userApiService.getUser(userId,corpId,"",token);
//                String signPic = StringUtils.null2String(user.get("signPic"));
//                if(StringUtils.isNotBlank(signPic)){
//                    comment.put("signPic",signPic);
//                }else{
//                    comment.put("signPic","");
//                }
//            }else if(type.indexOf("image")!=-1){
//            	 Object fullMessage=comment.get("fullMessage");
//            	 if(fullMessage!=null){
//            		 Map<String, String> paramMap=new HashMap<String,String>();
//            		 paramMap.put("corpId", corpId);
//            		 paramMap.put("recordId", fullMessage+"");
//            		 String scopeMap = restClient.get("/cmp/goldgrid/redocument/getReDocumentFileMap",token, paramMap);
//            		 Map<String,Object> map = JsonUtils.readValue(scopeMap);
//            		 comment.put("fullMessage","");
//            		 if(map.get("type").toString().equals("success")){
//            			 Map<String,Object> data = (Map<String, Object>) map.get("data");
//            			 String code=data.get("code").toString();
//            			 if(StringUtils.equals("0", code)){
//            				 Map<String,Object> attachment = (Map<String, Object>) data.get("attachment");
//            				 comment.put("fullMessage",attachment.get("id"));
//            			 }
//            		 }
//            	 }else{
//            		 comment.put("fullMessage","");
//            	 }
//            }
//        }
//        return commentList;
//    }
	
    /**
     * 处理批示意见显示
     * @param commentList
     * @return
     */
    public List<Map<String,Object>> dealwithComment(List<Map<String,Object>> commentList,String corpId,String token){
    	RestClient restClient = new RestClient(true);
    	for(int i=0; i<commentList.size(); i++){
            Map<String,Object> comment = commentList.get(i);
            String type = StringUtils.null2String(comment.get("type"));
            if ("text0".equals(type)) {//姓名+日期时间
            }else if("text1".equals(type)){//姓名+日期
                String time = StringUtils.null2String(comment.get("time"));
                if(StringUtils.isNotBlank(time)){
                    time = time.substring(0,10);
                    comment.put("time",time);
                }
            }else if("text2".equals(type)){//签名图片+日期时间
                String userId = StringUtils.null2String(comment.get("userId"));
                Map<String, Object> user = userApiService.getUser(userId,corpId,"",token);
                String signPic = StringUtils.null2String(user.get("signPic"));
                if(StringUtils.isNotBlank(signPic)){
                    comment.put("signPic",signPic);
                }else{
                    comment.put("signPic","");
                }
            }else if("text3".equals(type)){//签名图片+日期
                String time = StringUtils.null2String(comment.get("time"));
                if(StringUtils.isNotBlank(time)){
                    time = time.substring(0,10);
                    comment.put("time",time);
                }
                String userId = StringUtils.null2String(comment.get("userId"));
                Map<String, Object> user = userApiService.getUser(userId,corpId,"",token);
                String signPic = StringUtils.null2String(user.get("signPic"));
                if(StringUtils.isNotBlank(signPic)){
                    comment.put("signPic",signPic);
                }else{
                    comment.put("signPic","");
                }
            }else if(type.indexOf("image")!=-1){
            	 Object fullMessage=comment.get("fullMessage");
            	 if(fullMessage!=null){
            		 Map<String, String> paramMap=new HashMap<String,String>();
            		 paramMap.put("corpId", corpId);
            		 paramMap.put("recordId", fullMessage+"");
            		 String scopeMap = restClient.get("/cmp/goldgrid/redocument/getReDocumentFileMap",token, paramMap);
            		 Map<String,Object> map = JsonUtils.readValue(scopeMap);
            		 comment.put("fullMessage","");
            		 if(map.get("type").toString().equals("success")){
            			 Map<String,Object> data = (Map<String, Object>) map.get("data");
            			 String code=data.get("code").toString();
            			 if(StringUtils.equals("0", code)){
            				 Map<String,Object> attachment = (Map<String, Object>) data.get("attachment");
            				 comment.put("fullMessage","fid="+attachment.get("id")+"&chksum="+attachment.get("checksum"));
            			 }
            		 }
            	 }else{
            		 comment.put("fullMessage","");
            	 }
            }
        }
        return commentList;
    }
    
    /**
     * 发送提醒功能
     */
    @ApiOperation(value = "发送提醒", notes = "发送提醒")
    @RequestMapping(value = "/sendMeetingRemind", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> sendMeetingRemind(HttpServletRequest request) {
    	 Map<String, Object> resultMap = new HashMap<String, Object>();
         try {
	    	WebUser user = WebUtils.getCurrentUser();
	    	String token = user.getJwtToken();
	    	Map<String,String> paramsMap = new HashMap<String,String>();
	    	paramsMap.put("userArrays", request.getParameter("userArrays"));
	    	paramsMap.put("applyRecordId", request.getParameter("applyRecordId"));
	    	paramsMap.put("context", request.getParameter("context"));
	    	paramsMap.put("userId", user.getUserId());
	    	paramsMap.put("userName", user.getCnName());
	    	paramsMap.put("org", user.getOrgId());
	    	paramsMap.put("corpId", user.getCorpId());
	    	paramsMap.put("token", token);
	    	RestClient restClient = new RestClient();
	    	String configJson = restClient.post("/meeting/noticeInfo/sendMeetingRemind", token, paramsMap);
	        Map<String, Object> result = JsonUtils.readValue(configJson);
	        String type = StringUtils.null2String(result.get("type"));
	        String msg = StringUtils.null2String(result.get("message"));
	        if("success".equals(type)){
	            resultMap.put("success", Boolean.valueOf(true));
	            resultMap.put("content", msg);
	        }else{
	            resultMap.put("success", Boolean.valueOf(false));
	            resultMap.put("errorMsg", msg);
	        }
	    } catch (Exception e) {
	        resultMap.put("success", Boolean.valueOf(false));
	        resultMap.put("errorMsg", "发送失败");
	        e.printStackTrace();
	    }
        return resultMap;
    }
    
    @ApiOperation(value = "纪要转发功能", notes = "纪要转发功能")
    @RequestMapping(value = "/transmitMemo", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> transmitMemo(HttpServletRequest request) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
        	WebUser user = WebUtils.getCurrentUser();
            String corpId = user.getCorpId();
            String token = user.getJwtToken();
            String memoId =  request.getParameter("memoId");
            String jsonStrTransmiScope =  request.getParameter("jsonStrTransmiScope");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("token", token);
            paramsMap.put("memoId", memoId);
            paramsMap.put("jsonStrTransmiScope", jsonStrTransmiScope);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/memoInfo/transmitMemo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
        	String msg = StringUtils.null2String(result.get("message"));
        	if("success".equals(type)){
        		resultMap.put("success", Boolean.valueOf(true));
        		resultMap.put("content", msg);
        	}else{
        		resultMap.put("success", Boolean.valueOf(false));
        		resultMap.put("errorMsg", msg);
        	}
        } catch (Exception e) {
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "转发失败");
            e.printStackTrace();
        }
        return resultMap;
    }
    
    @ApiOperation(value = "删除会议纪要", notes = "删除会议纪要")
    @RequestMapping(value = "/deleteMemoInfo", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> deleteMemoInfo(HttpServletRequest request) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        try {
        	WebUser user = WebUtils.getCurrentUser();
            String corpId = user.getCorpId();
            String token = user.getJwtToken();
            String memoId =  request.getParameter("memoId");
            
            Map<String,String> paramsMap = new HashMap<String,String>();
            paramsMap.put("corpId", corpId);
            paramsMap.put("token", token);
            paramsMap.put("memoId", memoId);
            
            RestClient restClient = new RestClient();
    		String configJson = restClient.post("/meeting/memoInfo/deleteMemoInfo", token, paramsMap);
    		Map<String, Object> result = JsonUtils.readValue(configJson);
    		String type = StringUtils.null2String(result.get("type"));
        	String msg = StringUtils.null2String(result.get("message"));
        	if("success".equals(type)){
        		resultMap.put("success", Boolean.valueOf(true));
        		resultMap.put("content", msg);
        	}else{
        		resultMap.put("success", Boolean.valueOf(false));
        		resultMap.put("errorMsg", msg);
        	}
        } catch (Exception e) {
            resultMap.put("success", Boolean.valueOf(false));
            resultMap.put("errorMsg", "删除失败");
            e.printStackTrace();
        }
        return resultMap;
    }
}